<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title>bind例子</title>
      	<script type="text/javascript" src="../js/angular.js" ></script>
        <script type="text/javascript">
        var self = { name: 'boyi' };
        //示例1--带参数
        var f = angular.bind(self, //绑定对象，作为函数的上下文
        //被绑定的函数
        function (age) {
        alert(this.name + ' is ' + age + ' !');
        },
        //绑定的参数，可省略
        '15'
        );
        f();//调用绑定之后的function
        //示例2--不带参数
        var m = angular.bind(self,function (age) {
        	alert(this.name + ' is ' + age + ' !');
        });
        m(3);//输出boyi is 3！
        </script>
</head>
<body>
</body>
</html>